package com.pzb.web.controller.wechat;

import com.pzb.common.core.controller.BaseController;
import com.pzb.common.core.domain.AjaxResult;
import com.pzb.wechat.domain.WechatUserAccount;
import com.pzb.wechat.service.IWechatUserAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统模块Controller
 * 
 * @author Mr_Wu
 * @date 2021-11-30
 */
@RestController
@RequestMapping("/user")
public class WechatUserController extends BaseController
{
    @Autowired
    private IWechatUserAccountService wechatUserAccountService;

    /**
     * 用户信息
     * @param
     * @return
     */
    @GetMapping("/info")
    public AjaxResult userInfo()
    {
        return AjaxResult.success(getLoginUser().getUser());
    }

    /**
     * 用户账户信息
     * @param
     * @return
     */
    @GetMapping("/assets")
    public AjaxResult assets(@RequestParam("extAppid")String extAppid)
    {
        WechatUserAccount account = wechatUserAccountService.selectWechatUserAccountByOpenId(getOpenid(),extAppid);
        return AjaxResult.success(account);
    }


}
